import java.util.*;
import java.math.*;

public class euler007 {
	
	static public void main(String[] params) {
		final int P = 10000000, B = 10001;
		int i,j;
		
		//Sieve of Eratosthenes
		boolean primes[] = new boolean[(int)P];
		i = 2;
		for(i = 2; i < primes.length/2; i++)
			if(!primes[i])
				for(j=2*i; j<primes.length; j+=i)
					primes[j] = true;
		
		for(j=0,i=2; i<primes.length && j<B; ++i, j+=(primes[i-1])?0:1);
		
		System.out.println(i-1);
	}
}

